package com.tpc.control.util;

import com.tpc.control.jpa.EntityManagerHelper;
import com.tpc.control.jpa.Status;
import com.tpc.control.jpa.StatusDAO;
import com.tpc.control.jpa.StatusId;



public class Util {
	
	public static StatusDAO statusDAO = new StatusDAO();
	public static StatusId statusId = new StatusId();
	
	
	public static String addSpace(String str, int length)
	{
		if(str.length()>=length)
		{
			return str;
		}
		else if(str == null)
		{
			return null;
		}
		else
		{
			while(str.length()<length)
			{
				str = str + " ";
			}
			return str;
		}
	}
	public static String getStatus(int i)
	{
		statusId.setStatusCode(i);
		statusId.setStatusType("RESERVE");
		EntityManagerHelper.beginTransaction();
		Status status = statusDAO.findById(statusId);
		EntityManagerHelper.commit();
		EntityManagerHelper.closeEntityManager();
		
		return status.getStatusName();
		
	}
}
